<script type="text/javascript">
function initinput() {
	window.location='over.php';
}

function installOver(){
	var btn=document.getElementById('laststep');
	btn.disabled='';
	btn.value='安装成功，点击进入下一步';
}
</script>
<div class="container">
	<div class="header">
		<h1>风尚 安装向导</h1>

		<span>官方 <a href="http://www.fengsh8.com" target="_blank">http://www.fengsh8.com</a></span>
		<span style="margin-right:40px"> 简体中文 UTF_8 版 20101022</span>
		<div class="setup step3">
		<h2>安装数据库</h2>
		<p>正在执行数据库导入操作</p>
	</div>
	<div class="stepstat">
		<ul>
			<li class="">1</li>

			<li class="">2</li>
			<li class="current">3</li>
			<li class="unactivated last">4</li>
		</ul>
		<div class="stepstatbg stepstat3"></div>
	</div>
</div>
<div class="main">
	<div class="main">
		<div class="btnbox">
		<div id="notice" style="width:80%; margin:0px auto; border:1px solid #055476; height:120px; margin-bottom:10px;"></div>
		</div>
		<div class="btnbox marginbot">
        <input type="button" onclick="history.back();" value="上一步">&nbsp;
		<input type="button" name="laststep" value="正在安装..." disabled style="height:35" id="laststep" onclick="initinput()">
	</div>
	<div class="footer">风尚淘宝客 <a href="http://www.fengsh8.com/help/" target="_blank">帮助中心</a></div>	
	<div class="footer">&copy;2010 - 2011 <a href="http://www.fengsh8.com/">www.fengsh8.com</a></div>
	</div>
</div>
<?php
error_reporting(0);


if(!$_POST&&$_REQUEST['restall']!='yes'){
	reload_js('','install.php?step=2');
}

ini_set('memory_limit','20M');

function showinfo($str){
	echo "<script language='javascript'>document.getElementById('notice').innerHTML='".addslashes($str)."';</script>";
}


if($_GET['cover']=='yes'){
	dropAllTable();
}


$error1=true;
$error2=true;
$con=file_get_contents('fengsh_shop.sql');
preg_match_all("/CREATE(.*);/Uis",$con,$sql1);
preg_match_all("/INSERT(.*)\);/Uis",$con,$sql2);
			
$error_msg="";

foreach($sql1[0] as $arr){
	$arr=str_replace("fengsh_",$prefix,$arr);
	if(!mysql_query($arr)){
		$error1=false;
		$error_msg.=mysql_error();
	}
}
foreach($sql2[0] as $k => $arr){
	$arr=str_replace("fengsh_",$prefix,$arr);
	if(!mysql_query($arr)){
		$error2=false;
		$error_msg.=$k." ".mysql_error();
	}
}
showinfo('ok~ gogogo!!!');
echo "<script language='javascript'>installOver();</script>";
		

?>
